<template>
  <div class="teseleirong">
    <div class="teseleirong_top tanxin">
      <img :src="listxx.coverImgUrl" />
      <div class="teseleirong_top_r">
        <h3>{{ listxx.name }}</h3>
        <div class="gxsj">最近更新：01月27日 （刚刚更新）</div>
        <div class="tanxin ann">
          <span>
            <i></i>

            播放</span
          >
          <button>+</button>
          <div class="shuju">({{ listxx.subscribedCount }})</div>
          <div class="shuju">({{ listxx.shareCount }})</div>
          <div class="shuju">({{ listxx.commentCount }})</div>
        </div>
      </div>
    </div>
    <div class="teseleirong_botton">
      <div class="tanxin tou">
        <div class="tou_l tanxin">
          <p>歌曲列表</p>
          <span>{{ listxx.trackCount }}首歌</span>
        </div>
        <div class="tou_r">
          播放:
          <span>{{ listxx.playCount }}</span>
          次
        </div>
      </div>
      <ul class="ultlit tanxin">
        <li class="li1">&nbsp;</li>
        <li class="li2">标题</li>
        <li class="li3">时长</li>
        <li class="li4">歌手</li>
      </ul>
      <ul
        :class="index < 3 ? 'tanxin ulgequ active' : 'tanxin ulgequ'"
        v-for="(item, index) in list"
        :key="index"
        @click="clickFn(item.id)"
      >
        <li class="li1">{{ index + 1 }}</li>
        <li class="li2 tanxin">
          <img class="img1" :src="item.al.picUrl" alt="" />
          <i class="img2"></i>
          <span>{{ item.name }}</span>
        </li>
        <!-- -->
        <li class="li3">{{ min(item) }}:{{ sec(item) }}</li>
        <li class="li4">{{ item.ar[0].name }}</li>
      </ul>
    </div>
  </div>
</template>

<script>
import { Getbofang } from "@/request/api";
export default {
  props: ["listxx", "list"],
  data() {
    return {};
  },
  created() {},
  methods: {
    clickFn(id) {
      Getbofang(id).then((res) => {
        if (res.data.code === 200) {
          this.$store.commit("Channegequrul", res.data.data[0].url);
        }
      });
    },
    min(list) {
      if (parseInt(list.dt / 60000) < 10)
        return "0" + parseInt(list.dt / 60000);
      else return parseInt(list.dt / 60000);
    },
    sec(list) {
      let x = parseInt(list.dt / 60000);
      let y = parseInt(list.dt / 1000 - x * 60);
      if (y < 10) return "0" + y;
      else return y;
    },
  },
};
</script>
 
<style lang = "less" scoped>
@import "@/assets/base.less";
.teseleirong {
  width: 740px;
  .teseleirong_top {
    margin-top: 50px;
    justify-content: flex-start;
    img {
      margin-left: 20px;
      padding: 2px;
      border: 1px solid #ccc;
      width: 150px;
      height: 150px;
      box-sizing: border-box;
    }
    .teseleirong_top_r {
      margin-left: 30px;
      h3 {
        font-weight: 300;
      }
      .gxsj {
        margin-top: 20px;
        font-size: 14px;
      }
      .ann {
        margin-top: 20px;
        span {
          width: 70px;
          height: 30px;
          display: flex;
          justify-content: flex-start;
          background-color: rgb(23, 163, 228);
          border-radius: 10px 0 0 10px;
          text-align: center;
          line-height: 30px;
          font-size: 14px;
          color: #fff;
          i {
            display: block;
            width: 20px;
            height: 18px;
            background-image: url("@/assets/images/iconall.png");
            background-position: 2px 0;
            margin-left: 8px;
            margin-top: 5px;
            margin-right: 3px;
            background-color: #fff;
            border-radius: 50%;
          }
        }
        button {
          height: 30px;
          line-height: 30px;
          min-width: 23px;
          border: none;
          cursor: pointer;
          border-left: 1px solid #ccc;
          background-color: rgb(23, 163, 228);
          border-radius: 0px 10px 10px 0px;
        }
        .shuju {
          height: 30px;
          padding-right: 2px;
          padding-left: 28px;
          line-height: 30px;
          min-width: 23px;
          cursor: pointer;
          color: #333;
          background-color: #ccc;
          margin-left: 10px;
          border-radius: 5px;
          border: 1px solid #999;
        }
      }
    }
  }
  .teseleirong_botton {
    width: 670px;
    /* height: 40px; */
    margin-top: 50px;
    border-bottom: 1px solid #ccc;
    .tou {
      .tou_l {
        justify-content: flex-start;
        line-height: 40px;
        p {
          font-size: 20px;
          margin-right: 20px;
          font-weight: 500;
        }
        span {
          display: block;
          font-size: 14px;
          color: #ccc;
          padding-top: 3px;
        }
      }
      .tou_r {
        line-height: 40px;
        color: #999;
        span {
          color: @red;
          font-size: 15px;
        }
      }
    }
    .ultlit {
      width: 100%;
      border-top: 3px solid @red;
      border-bottom: 1px solid #ccc;
      li {
        height: 40px;
        border-right: 1px solid #ccc;
        text-align: left;
        line-height: 40px;
        font-size: 14px;
        color: rgb(116, 116, 116);
        padding-left: 5px;
      }
      .li1 {
        border-left: 1px solid #ccc;
        width: 75px;
      }
      .li2 {
        width: 60%;
      }
      .li3 {
        width: 100px;
      }
      .li4 {
        width: 26%;
      }
    }
    .ulgequ {
      text-align: left;
      padding-left: 5px;
      border: 1px solid #ccc;
      border-top: none;
      border-bottom: none;
      height: 30px;
      background-color: rgb(233, 233, 233);
      &:nth-child(2n) {
        background-color: #fff;
      }
      &.active {
        height: 70px;
        li {
          line-height: 70px;
        }
        .li2 {
          .img1 {
            display: block;
            width: 50px;
            height: 50px;
            margin-top: 15px;
            margin-right: 20px;
          }
          .img2 {
            margin-top: 30px;
          }
        }
      }
      li {
        height: 30px;
        line-height: 30px;
      }
      .li1 {
        width: 75px;
      }
      .li2 {
        width: 60%;
        justify-content: flex-start;
        span {
          font-size: 13px;
        }
        .img1 {
          display: none;
        }
        .img2 {
          width: 20px;
          height: 20px;
          background-image: url("@/assets/images/iconall.png");
          background-position: 0 0;
          margin-top: 6px;
          margin-right: 10px;
        }
      }
      .li3 {
        width: 100px;
      }
      .li4 {
        width: 26%;
      }
    }
  }
}
</style>